package dataMining.FP_Growth;

import java.io.File;

public class Test {
    public static void main(String args[]) {
        ITree itr;                       //存储所有项集的树
        File f;
        FPGrowth fpg = new FPGrowth();
        FPTree pt = new FPTree();
        CreateFPTree c = new CreateFPTree();
        int support = 100;
        String fileName = "C:/Users/freedom/Desktop/top_k/试验/经典算法收集/fpgrowth(java)/sample.txt";
        try {
            support = 1000;
            fileName = "C:/Users/freedom/Desktop/开题报告文章收集/fimi数据集/mushroom.dat/mushroom.txt";
            if (support < 0) {
                System.out.println("支持度阈值不能是负值");
                System.exit(1);
            }
        } catch (Exception e) {
            System.out.println("参数输入错误");
            System.exit(1);
        }
        c.SetFPTree(pt);
        f = new File(fileName);
        c.start(f);                            //从事务文件f中产生FP_Tree pt
        itr = new ITree();
        fpg.Start(pt, itr, support);                     //用FP-Growth算法产生项集存储在项集树（ITree）itr
        System.out.println("频繁项集");
        itr.print(itr.head, new Stack());
    }
}

